from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

from auth_service import auths
from file import main as file_main
from knowledge_base import main as knowledge_main
from model import main as model_main
from retriever import main as retriever_main
from query import main as query_main
from faq import main as faq_main

app = FastAPI(
    tags=["baseline rag"],
    responses={404: {"description": "Not found"}},
)

app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

app.include_router(auths.router)
app.include_router(file_main.router)
app.include_router(knowledge_main.router)
app.include_router(model_main.router)
app.include_router(retriever_main.router)
app.include_router(query_main.router)
app.include_router(faq_main.router)


@app.get("/")
async def root():
    return {"message": "Welcome to FC RAG!"}

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8031)

